package theory.vanpelt.bifurcation;

import optimization.NewtonNonlinearSolver;
import optimization.LinearAlgebra.VectorFunction;

public class BEFindValues {
	
	public static double[] find(double m, double s)
	{
		VectorFunction fest = new VectorFunction() {
			@Override
			public int yDim() {
				return 2;
			}
			@Override
			public double[] evaluate(double[] p) {
				PDistEstimate pd = new PDistEstimate(p[0], p[1]);
				return new double[]{ pd.getMeanEst(), pd.getDevEst() };
			}
		};
		
		return NewtonNonlinearSolver.newtonNonlinearSolver(fest, new double[]{2.0, 0.4}, new double[]{m, s}, 0.0001);
	}
}
